/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import { Entity, PrimaryColumn, ManyToOne, JoinColumn, Column } from "typeorm";
import { PrizeEntity } from "./PrizeEntity";
import { MemberEntity } from "./MemberEntity";

@Entity({ schema: "lottery", name: "l_winner" })
export class WinnerEntity {
	
    @PrimaryColumn({name: "w_uid", type: "varchar", length: 40 })
	//@Generated("uuid")
    id: string;
	
	@ManyToOne(type => PrizeEntity, { eager: true })
    @JoinColumn([
		{ 
			name: "w_bingo",
			referencedColumnName: "bid"
		},
		{ 
			name: "w_prize",
			referencedColumnName: "pid"
		}
	])
	prize : PrizeEntity;
	
	@ManyToOne(type => MemberEntity, { eager: true })
    //@Column({name: "w_member", type: "varchar", length: 40 })
	@JoinColumn({ 
        name: "w_member",
        referencedColumnName: "id"
    })
	member : MemberEntity;


    @Column({name: "w_create", type: "timestamp", nullable : true })
	create : Date;

}
